<!--# layout("/common/layout.html",{"jsBase":"/js/cms/siteFunds/"}){ -->

<form class="layui-form " id="addForm">
    <fieldset class="layui-elem-field">
        <legend>站点资助经费业务信息</legend>
        <div class="layui-row">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">工作站名称<span style="color: red">*</span></label>
                    <div class="layui-input-inline">
                        <select name="workstationName" id="workstationName" lay-verify="required" lay-filter="workstationName">
                            <option value=""></option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">国家或省批准站文号<span style="color: red">*</span></label>
                    <div class="layui-input-inline">
                        <input type="text" id="approvalNumber" name="approvalNumber"  lay-verify="required" class="layui-input input-readonly"  readonly>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">建站时间<span style="color: red">*</span></label>
                    <div class="layui-input-inline">
                        <input type="text" id="timeConstruction" name="timeConstruction"    class="layui-input input-readonly" readonly>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">单位名称<span style="color: red">*</span></label>
                    <div class="layui-input-inline">
                        <input type="text" id="unitName" name="unitName" value="${unitName}" lay-verify="required" readonly class="layui-input input-readonly" >
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">资助经费申报项目<span style="color: red">*</span></label>
                    <div class="layui-input-inline">
                        <layui:simpleDictSelect style='layui-input-inline' type="fundingProjects"
                                                id="fundingProjects" name="fundingProjects"  layVerify="required" lay-filter="fundingProjects"/>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">申报金额<span style="color: red">*</span></label>
                    <div class="layui-input-inline">
                        <input type="text" id="declarationAmount" name="declarationAmount" lay-verify="required" class="layui-input input-readonly" readonly>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">开户银行(工商银行)<span style="color: red">*</span></label>
                    <div class="layui-input-inline">
                        <input type="text" id="openingBank" name="openingBank" lay-verify="required" class="layui-input" >
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">户名<span style="color: red">*</span></label>
                    <div class="layui-input-inline">
                        <input type="text" id="householdName" name="householdName"  lay-verify="required" class="layui-input" >
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">银行卡号<span style="color: red">*</span></label>
                    <div class="layui-input-inline">
                        <input type="text" id="bankNumber" name="bankNumber" class="layui-input"  lay-verify="required|number">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">特殊情况说明(最多100汉字)</label>
                    <div class="layui-input-inline">
                        <textarea id="specialInstructions" name="specialInstructions"   class="layui-textarea" style="width: 740px" maxlength="200"></textarea>
                    </div>
                </div>
            </div>
        </div>
    </fieldset>

    <fieldset class="layui-elem-field">
        <legend>材料信息</legend>
        <span style="color: red;margin-left: 30px;font-size: 18px">支持文件格式为：pdf,jpg,png,gif，单个文件大小不超过20M。带*号标识的对应资料必须上传，其它资料不作要求。上传文件内容请确保真实清晰、有效，不能有旋转。上传后请查看预览，正确无误后再申报提交。</span>
        <div class="layui-row">
            <label class="layui-form-label file-upload">国家或省博管办同意设站的批文复印件<span style="color: red">*</span></label>
            <layui:attachment name="copiesDocuments" batchFileUUID="${uuid()}" isNew="true" lay-verify="required" bizType="User"/>
        </div>
        <div class="layui-row">
            <label class="layui-form-label file-upload">市经费资助证明材料<span style="color: red">*</span></label>
            <layui:attachment name="proofMaterial" batchFileUUID="${uuid()}" isNew="true" lay-verify="required" bizType="User"/>
        </div>
    </fieldset>

    <layui:personnelsubmitButtons id="addButton" />
</form>
<!--#} -->
<script>
layui.use(['add'], function(){
    var siteFundsAdd = layui.add;
    siteFundsAdd.init();

    var form = layui.form;
    form.on('select(workstationName)', function (data) {
        $.ajax({
            url: Common.ctxPath + "/cms/siteFunds/findSite.do",
            data:{id:data.value},
            dataType: 'json',
            type: 'post',
            success: function (data) {
               $("#approvalNumber").val(data.approvalNumber);
                $("#timeConstruction").val(new Date(data.timeConstruction).format("yyyy-MM-dd"));
            }
        })
        if(data.value==""){
            $("#approvalNumber").val("");
            $("#timeConstruction").val("");
        }
    });

    form.on('select(fundingProjects)', function (data) {
        var value = data.value;
        if (value == 1 || value == 2) {
            $("#declarationAmount").val(150000.00);
        } else if (value == 3 || value == 4){
            $("#declarationAmount").val(100000.00);
        }
    });
});

layui.use(['layer', 'form', 'element'], function () {
    var form = layui.form;
//检查项目添加到下拉框中
    $.ajax({
        url: Common.ctxPath + "/cms/siteFunds/getSite.do",
        dataType: 'json',
        type: 'post',
        success: function (data) {
        $.each(data, function (index, item) {
            $("#workstationName").append(new Option(item.workstationName, item.id));// 下拉菜单里添加元素
        });
        layui.form.render("select");
    }
})
});
</script>
